home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-06-23 | 2.0 KB | 69 lines |
- /**
- * An abstract class to implement the functionality associated with
- * a "roll over button." The basic behavior is such that when the mouse
- * is "rolled over" the button, the button reacts by displaying a
- * different image to give instant feedback to the user.
- */
- public abstract class RolloverButton extends ImageButton
- {
- //Declare data members
- //Insert "RolloverButton data members"
-
- /**
- * Constructs a default instance of this class.
- */
- public RolloverButton()
- {
- //Initialize the state of the button
- //Insert "RolloverButton init state"
- }
-
- /**
- * Sub classes need to define this to handle initializing their
- * images, and state information.
- */
- protected abstract void initImages();
-
- /**
- * Sets the button to be in the correct configuration for the
- * current state.
- */
- public void refreshImage()
- {
- //Handle determining the current state, and reacting appropriately
- //Insert "RolloverButton refreshImage"
- }
-
- /**
- * Gets called when the mouse button is pressed on this button.
- */
- protected void handleMousePressed()
- {
- //Set the image to the appropriate image for a mouse press.
- //Insert "RolloverButton mousePressed"
- }
-
- /**
- * Gets called when the mouse button is released on this button.
- * @param isMouseInside, if true, the mouse is located inside the button area,
- * if false the mouse is outside the button area.
- */
- protected void handleMouseRelease(boolean isMouseInside)
- {
- //Set the image to the appropriate image for a mouse release,
- //and calls the super classes version to include inherited functionality.
- //Insert "RolloverButton mouseReleased"
- }
-
- /**
- * Gets called when the mouse crosses into or out of the button area.
- * @param isMouseInside, is true if the mouse is in the button area,
- * false if it is outside.
- * @param isMouseDown, is true if the mouse button is pressed, false if it is not.
- */
- protected void handleRollover(boolean isMouseInside, boolean isMouseDown)
- {
- //Handle determining the current state, and reacting appropriately
- //Insert "RolloverButton handleRollover"
- }
- }